home *** CD-ROM | disk | FTP | other *** search
- Path: howland.reston.ans.net!psinntp!psinntp!psinntp!psinntp!usenet
- From: grantp@usa.pipeline.com(Pete Grant)
- Newsgroups: comp.lang.c++
- Subject: Re: Newbie Ques: Templates and C++
- Date: 23 Mar 1996 22:06:18 GMT
- Organization: Pipeline USA
- Message-ID: <4j1skq$bdt@news1.h1.usa.pipeline.com>
- References: <DoqLy6.H7q@novice.uwaterloo.ca>
- NNTP-Posting-Host: 38.8.60.5
- X-PipeUser: grantp
- X-PipeHub: usa.pipeline.com
- X-PipeGCOS: (Pete Grant)
- X-Newsreader: Pipeline v3.5.0
-
- On Mar 23, 1996 20:22:54 in article <Newbie Ques: Templates and C++>,
- 'a2patel@novice.uwaterloo.ca (Aashish-Kaski-Ashman-Patel)' wrote:
-
-
- >Ok.. Here is what I am trying to do:
- >1)
- >Have a class called Dictionary that depends on two other classes (
- determined
- >at compile time ).
- >ie. #ifdef HASH
- >class Dictionary Hash-Table;
- >#else-if BST
- >class Dictionary Bst;
- >#endif
- >
- Oops, I was concentrating on answering your questions and missed it. The
- class
- declarations above are incorrect. Maybe you want:
-
- class Dictionary : public HashTable<int> { ...};
-
- or
-
- template<class T>
- class Dictionary : public HashTable<T> { .. };
-
- or
-
- class Dictionary
- {
- private:
- HashTable<int> table;
-
- or .. whatever you want to do. It's not obvious from your post.
-
-
-
- --
-
- Pete Grant
- Kalevi, Inc.
- Sofware Engineering
-